<template>
    <Form :instance="pForm">
        <div class="blank "></div>
        <div style="display: grid;grid-gap: 2vw;grid-template-columns: 1fr 3fr;margin: 0 2vw;">
            <!-- 若存在后端，取消时重新拉取数据 -->
            <Button @click="router.back" style="border-radius: 6px;" type="danger">
                取消
            </Button>
            <Button @click="onUpdata" style="border-radius: 6px;" type="primary">完成
            </Button>
        </div>
    </Form>
    <div class="blank"></div>
</template>
<script lang="ts" setup>
import { useRoute, useRouter } from 'vue-router';
import Form from "@m/components/public/b_form.vue";
import { Rolefrom } from "@b/index/role";
import { Button } from 'vant';

const route = useRoute()
const router = useRouter()
const pForm = new Rolefrom()
pForm.id = route.query.id as string
pForm.setData()
pForm.init()
const onUpdata = async () => {
    const res = await pForm.updateData()
    if (res) {
        router.back()
    }
}
</script>